<?php

namespace App\Repository\Repositories;

use App\Repository\Models\Permission;
use App\Repository\Models\Menu;
use App\Repository\Repositories\Interfaces\MenuRepository;

/**
 * Class MenuRepositoryEloquent.
 *
 * @package namespace App\Repository\Repositories;
 */
class MenuRepositoryEloquent extends BaseRepository implements MenuRepository
{
    /**
     * 搜索
     * @var array
     */
    protected $fieldSearchable = [
    ];

    /**
     * Specify Model class name
     *
     * @return string
     */
    public function model()
    {
        return Menu::class;
    }

    /**
     * @param $name
     * @param $display_name
     * @param $description
     * 添加权限
     */
    public function add_menuPermission($name,$display_name,$description){
        $data=[
            'name'=>$name,
            'display_name'=>$display_name,
            'description'=>$description,
            'type'=>'menu'
        ];
        $perid=Permission::query()->create($data)->toArray();
        return $perid;
    }


}
